package com.example.day02.service.Imp;

import com.example.day02.service.PucherService;
import com.example.day02.service.SaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SaleServiceImp implements SaleService {


    @Autowired
    private PucherService pucherService;

    @Transactional
    @Override
    public void sale(String username, List<Integer> bookId) {
        bookId.forEach(id->{
            //n个ourchase事务方法
            pucherService.pucherGoods(username,id);
        });
    }
}
